|
In functional programming, a monad transformer is a type constructor which takes a monad as an argument and returns a monad as a result. Monad transformers can be used to compose features encapsulated by monads – such as state, exception handling, and I/O – in a modular way. Typically, a monad transformer is created by generalising an existing monad; applying the resulting monad transformer to the identity monad yields a monad which is equivalent to the original monad (ignoring any necessary boxing and unboxing). ==Definition== A monad transformer consists of: # A type constructor t of kind ( # Monad operations return and bind (or an equivalent formulation) for all t m where m is a monad, satisfying the monad laws# An additional operation, lift :: m a -> t m a , satisfying the following laws:〔〕 (the notation `bind` below indicates infix application):## lift . return = return ## lift (m `bind` k) = (lift m) `bind` (lift . k) 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「monad transformer」の詳細全文を読む スポンサード リンク
|